import com.example.c3p0.Util.C3p0Util;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @auther 尚智江
 * @Date 2022/5/14 22:09
 */
public class insertDao {
    public static void main(String[] args)throws SQLException {
        // 创建 QueryRunner 对象
        QueryRunner queryRunner = new QueryRunner(C3p0Util.getDataSource());
        String sql = "INSERT INTO user (username,password) VALUES('hello3','12345')";
        int num = queryRunner.update(sql);
        if(num>0){
            System.out.println("添加成功");
        }else {
            System.out.println("添加失败");
        }
    }
}
